﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class bigclassedit : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["User"]==null)
		{
			Response.Write("<script language=javascript>alert('您没有管理权限或者还没有登录，请先登录！');window.open('../login.aspx','_top');</script>");
			Response.End();
		}
		if (!Page.IsPostBack)
        {
            string id = Request.QueryString["id"];
            HiddenID.Value = id;
            if (!string.IsNullOrEmpty(id))
            {
                DataSet ds = Socut.Data.ExecuteDataSet("select bigclassname,bigclassorder from web_Notice_bigclass where id=" + id);
                STRtitle.Text = ds.Tables[0].Rows[0][0].ToString();
                STRorder.Text = ds.Tables[0].Rows[0][1].ToString();
            }
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string Msg, Url;
        if (string.IsNullOrEmpty(HiddenID.Value))
        {
            Socut.Data.ExecuteNonQuery("insert into web_Notice_bigclass (bigclassname,bigclassorder) values ('" + STRtitle.Text + "','" +  STRorder.Text + "')");
            Msg = "添加成功！";
            Url = "bigclassmanage.aspx";
        }
        else
        {
            Socut.Data.ExecuteNonQuery("update web_Notice_bigclass set bigclassname='" + STRtitle.Text + "',bigclassorder='" +  STRorder.Text + "' where id=" + HiddenID.Value);
            Msg = "修改成功！";
            Url = "bigclassmanage.aspx";
        }
        CommonFunction.ShowMessage(Msg,Url);
    }
}
